package com.citicup.backend.controller;


import com.citicup.backend.service.UserService;
import com.citicup.backend.vo.ResponseVO;
import com.citicup.backend.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 听取WA声一片
 */
@RestController
public class UserController {

    private final UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @PostMapping("/register")
    public ResponseVO register(@RequestBody UserVO userVO) {
        return userService.register(userVO);
    }

    @PostMapping("/login")
    public ResponseVO login(@RequestBody UserVO userVO) {
        return userService.login(userVO);
    }

    @GetMapping("/showUser/{id}")
    public ResponseVO showUser(@PathVariable Integer id) {
        return userService.showUser(id);
    }

    @PostMapping("/survey")
    public ResponseVO survey(@RequestBody UserVO newUser) {
        return userService.survey(newUser);
    }

}
